package com.xioyi.news.action;

import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.xioyi.news.domain.Person;
import com.xioyi.news.service.IPersonService;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

public class PersonAction extends DispatchAction {
	private IPersonService personService;
	public ActionForward createPerson(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		Person person=new Person();
		person.setFirstName("zhang");
		person.setLastName("fanhang");
		personService.save(person);
		return null;
	}
	public ActionForward getPerson(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		Person person = personService.find(2);
		
		return mapping.findForward("success");
	}
	/**
	 * @return the personService
	 */
	public IPersonService getPersonService() {
		return personService;
	}
	/**
	 * @param personService the personService to set
	 */
	public void setPersonService(IPersonService personService) {
		this.personService = personService;
	}
	
	
}
